草庐IT

android - 错误 : Execution failed for task \':app:packageDebug\'

全部标签

ruby-on-rails - 如何在 Rails 中使用 Rspec stub 错误引发?

我是Rails和Rspec的新手,我正在使用Rspec来测试这个包含异常处理的Controller方法:defsearch_movies_director@current_movie=Movie.find(params[:id])begin@movies=Movie.find_movies_director(params[:id])rescueMovie::NoDirectorErrorflash[:warning]="#{@current_movie}hasnodirectorinfo"redirect_tomovies_pathendend我不知道如何正确测试上述路径:在无效搜索后

ruby-on-rails - 切换到 Rails 4.1 时出现错误 - `method_missing':ActiveRecord::Base:Class (NoMethodError) 的未定义方法 `whitelist_attributes='

从Rails4.0切换到Rails4.1时出现此错误:activerecord-4.1.8/lib/active_record/dynamic_matchers.rb:26:in`method_missing':undefinedmethod`whitelist_attributes='forActiveRecord::Base:Class(NoMethodError)我没有在我的应用程序的任何地方使用attr_accessible或attr_protected所以我想知道为什么我有问题。当迁移到Rails4.0时,我已经安装了我的application.rb:配置/应用程序.rb:c

ruby - 获取名称错误 : `format' is not allowed as an instance variable name when testing instance variable with rspec

我有以下测试:let(:client){Descat::Client.new}describe'poblacio'doit'shouldsetformatcorrectly'doclient.poblacio('v1','json','dades')expect(client.instance_variable_get(:format)).toeq('json')endend我有以下正在测试的代码:moduleDescatclassClientBASE_URL='http://api.idescat.cat/'definitialize(attributes={})attributes

ruby - 尝试从 FTP 下载文件导致 "500 Illegal PORT command"错误

如果我在本地执行,一切正常:require'net/ftp'ftp=Net::FTP.new("myftpserver.com","username","password")ftp.getbinaryfile("/myfile.zip","localfile.zip")ftp.close如果我尝试在我使用的Linux服务器上执行它,结果是:/usr/local/lib/ruby/1.9.1/net/ftp.rb:273:in`getresp':500IllegalPORTcommand.(Net::FTPPermError)from/usr/local/lib/ruby/1.9.1/n

ruby - 我在 Mac OS X 上收到 "RVM is not a function"错误,并且没有发布的解决方案有效

我在MacOSx10.8.2(“MountainLion”)上,我成功安装了RVM1.17.8及其依赖项。我可以使用它来使用rvminstall1.9.2安装Ruby版本,但我无法执行rvmuse没有收到此错误:RVMisnotafunction,selectingrubieswith'rvmuse...'willnotwork.Youneedtochangeyourterminalemulatorpreferencestoallowloginshell.Sometimesitisrequiredtouse`/bin/bash--login`asthecommand.Pleasevis

ruby - 如何捕获由对等方重置的错误连接 (Errno::ECONNRESET)

以下代码有时会生成“连接被对等方重置”错误。谁能告诉我如何处理这个异常?doc=Nokogiri::HTML(open(url))Connectionresetbypeer(Errno::ECONNRESET) 最佳答案 要捕获它,就像处理任何其他异常一样:begindoc=Nokogiri::HTML(open(url))rescueErrno::ECONNRESET=>eputs"wearehandlingit!"end更有用的模式是尝试几次,然后放弃:count=0begindoc=Nokogiri::HTML(open(ur

ruby - 在 Ubuntu 中全新安装 RVM 不允许我安装 gems(zlib 错误)

好的,我刚刚使用VirtualBox在Windows7上创建了一个全新的Ubuntu11.04安装(不确定这是否重要,但仅供引用)列出我得到的ruby:aaron@aaron-VirtualBox:~$rvmlistrvmrubies=>ruby-1.9.2-p290[x86_64]然后尝试安装railsgem我得到了这个:aaron@aaron-VirtualBox:~$geminstallrailsERROR:Loadingcommand:install(LoadError)nosuchfiletoload--zlibERROR:Whileexecutinggem...(NameE

ruby - Octopress 将错误推送到 GitHub

我正在尝试将octopress推送到github页面,到目前为止一切正常,但是当我在显示octopress文件后执行rakedeploy命令时,出现以下错误Togit@github.com:rukshn/rukshn.github.io.git![rejected]master->master(non-fast-forward)error:failedtopushsomerefsto'git@github.com:rukshn/rukshn.github.io.git'hint:Updateswererejectedbecausethetipofyourcurrentbranchisb

ruby-on-rails - 如何修复 Mavericks 上 Gemfile 的 libv8 错误?

当我运行bundleinstall时,我得到了Anerroroccurredwhileinstallinglibv8(3.11.8.17),andBundlercannotcontinue.Makesurethat`geminstalllibv8-v'3.11.8.17'`succeedsbeforebundling.Libv8是lunchy和therubyracergems的依赖项。我已经在3.11.8.17上锁定了我的Gemfile.locklibv8gem但是我发现我可以降级到3.3.10.4bundleinstall/update:libv8(therubyracer)inst

ruby - 加载错误机架/测试

运行测试文件时出现以下错误。$rubytest/test_gothonweb.rb/Users/sony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require':cannotloadsuchfile--rack/test(LoadError)from/Users/sony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`requir